/*
    Copyright 2010 Alex Margarit

    This file is part of a2x-framework.

    a2x-framework is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    a2x-framework is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with a2x-framework.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "a2x_pack_sdl.v.h"

void a_sdl__set(void)
{
    Uint32 sdlFlags = 0;

    if(a2x_bool("window")) {
        sdlFlags |= SDL_INIT_VIDEO;
    }

    #if !(A_PLATFORM_WIZ || A_PLATFORM_CAANOO)
        sdlFlags |= SDL_INIT_TIMER;
    #endif

    #if A_PLATFORM_GP2X || A_PLATFORM_WIZ || A_PLATFORM_CAANOO
        sdlFlags |= SDL_INIT_JOYSTICK;
    #endif

    if(a2x_bool("sound")) {
        sdlFlags |= SDL_INIT_AUDIO;
    }

    SDL_Init(sdlFlags);
}

void a_sdl__free(void)
{
    SDL_Quit();
}
